﻿#pragma strict

@script ExecuteInEditMode()

var minimapSize : float = 2.0;
var offsetX : float = 10.0;
var offsetY : float = 10.0;
private var adjustSize : float = 0.0;

var borderTexture : Texture;
var minimapCamera : Camera;

function Update() { 
if (minimapCamera == null) return;

//Adjusting the window size of the minimap and its location.
adjustSize = Mathf.RoundToInt(Screen.width/10);
minimapCamera.pixelRect = new Rect(Screen.width - ((minimapSize * adjustSize) + offsetX), (Screen.height -(minimapSize * adjustSize)) - offsetY, minimapSize * adjustSize, minimapSize * adjustSize);

}

function OnGUI(){
//Places a border around the minimap window.
if(borderTexture != null){
GUI.DrawTexture(Rect(Screen.width - ((minimapSize * adjustSize) + offsetX), offsetY, minimapSize * adjustSize, minimapSize * adjustSize), borderTexture); }
}